package com.sunqianhu.design_patterns_23.behavioral.strategy;

public class Duck {
    private FlyBehavior flyBehavior;

    public Duck(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    // 设置飞行行为
    public void setFlyBehavior(FlyBehavior fb) {
        flyBehavior = fb;
    }

    // 执行飞行行为
    public void performFly() {
        flyBehavior.fly();
    }
}
